package com.loong.game2048.dao;

import com.loong.game2048.module.Game;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author lyx
 * @date 2020/5/23 20:29
 */
@Mapper
public interface GameDao {

    @Select("select * from game ")
    @Results(id = "game",value = {
            @Result(property = "id",column = "id"),
            @Result(property = "game",column = "game")
    })
    List<Game> getAllGame();

    @Insert("insert into game(game) value(#{game})")
    @ResultMap("game")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    Integer addTag(Game game);

    @Select("select count(id) from game where game = #{game}")
    Integer getTag(@Param("game") String game);

}
